import { Contoller } from "./Controller";

export interface CardOptions {
	id: string;
	name: string;
	type: "BASIC" | "EQUIP" | "TRICK";
	color: "HEART" | "DIAMAND" | "SPADE" | "CLUB";
	point:
		| "A"
		| "1"
		| "2"
		| "3"
		| "4"
		| "5"
		| "6"
		| "7"
		| "8"
		| "9"
		| "1"
		| "J"
		| "Q"
		| "K";
	effect?: (...args: any[]) => any;
}

export class Card extends Contoller {
	type(): string {
		return "SGS.Model.Card";
	}
	constructor(public option: CardOptions) {
		super();
	}

	effect(callback?: (...args: any[]) => any): void {
		if (this.option.effect) {
			return this.option.effect();
		}

		if (callback) {
			callback();
		}
	}
}
